/*
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 *
 * Copyright @2008 the original author or authors.
 */
package com.bluestone.run;

import java.util.HashMap;

import com.bluestone.core.TestCase;

/**
 * @author <a href="mailto:bluestone.daniel.q@gmail.com">daniel.q</a>
 * 
 */
public class TestSuiteReport {

	private String reportFile;

	private HashMap testcaseReports = new HashMap();

	private HashMap passMap = new HashMap();

	private HashMap failureMap = new HashMap();

	private boolean executecode = true;

	public void setExecutecode(boolean executecode) {
		this.executecode = executecode;
	}

	public boolean getExecutecode() {
		return this.executecode;
	}

	public void addFailureCase(TestCase testcase) {
		this.failureMap.put(testcase, testcase);
	}

	public void addPassCase(TestCase testcase) {
		this.passMap.put(testcase, testcase);
	}

	public int getFailureCount() {
		return this.failureMap.size();
	}

	public String getReportFile() {
		return reportFile;
	}

	public void setReportFile(String reportFile) {
		this.reportFile = reportFile;
	}

	public HashMap getTestcaseReports() {
		return testcaseReports;
	}

	public void setTestcaseReports(HashMap testcaseReports) {
		this.testcaseReports = testcaseReports;
	}

	public void addTestCaseReport(TestCaseReport caseReport) {
		if(caseReport.getId()!=null||!"".equals(caseReport.getId())){
			this.testcaseReports.put(caseReport.getId(), caseReport);
		}
	}

	public TestCaseReport getTestCaseReport(String id) {
		Object obj = this.testcaseReports.get(id);
		if (obj != null)
			return (TestCaseReport) obj;
		return null;
	}

	@Override
	public String toString() {

		String str = "testsuite:";
		if (reportFile != null) {
			str = str + "reportFile=" + reportFile;
		}
		return (str);
	}

}
